/**
 * Created by 徐嘉宾 on 2016/10/28.
 */
$(function() {
    $('#upload').click(function () {
        var form = new FormData($('#form1')[0]);
        $.ajax({
            url: 'http://up.qiniu.com',
            type: 'POST',
            cache: false,
            data: form,
            success: function (data) {
                $("#loading").hide();
                if (data.ret == 'error') {
                    alert(data.error);
                } else {
                    alert("上传成功！");
                }
            },
            beforeSend:function(){
                $("#loading").show();
            },
            complete:function(){
                $("#loading").hide();
            },
            processData: false,
            contentType: false
        });
    });
    $("#loading").hide();
});
